﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace IronWinter
{
    public class Equipment
    {

        public static int DISPLAY_SIZE = 64;

        


        // each value is the change in attribute a unit can expect. 
        protected bool m_canMoveWhileAttacking;

        protected int m_maxHealth, m_currHealth, m_armor, m_atkPow, m_armorPen, m_value;
        protected float m_moveSpeed, m_atkMoveSpeed;

        protected int m_cost = 20;

        protected string m_name = "name";

        public Color color;

        protected AnimatedSprite m_sprite;
        public Texture2D texture;
        public int range;
        public float rate;

        // (affects character attributes) GET and SET methods

        public bool canMoveWhileAttacking
        {
            get { return m_canMoveWhileAttacking; }
        }

        public int maxHealth
        {
            get { return m_maxHealth; }
        }

        public string name
        {
            get { return m_name; }
        }

        public int armor
        {
            get { return m_armor; }
        }

        public int atkPow
        {
            get { return m_atkPow; }
        }

        public int armorPen
        {
            get { return m_armorPen; }
        }

        public int value
        {
            get { return m_value; }
        }

        public float moveSpeed
        {
            get { return m_moveSpeed; }
        }

        public float atkMoveSpeed
        {
            get { return m_atkMoveSpeed; }
        }

        public Equipment(
            bool moveWhileAttacking,
            int maxHealth,
            int armor,
            int atkPow,
            int armorPen,
            float moveSpeed,
            int value,
            string nam,
            Texture2D tex)
        {
            m_canMoveWhileAttacking = moveWhileAttacking;
            m_maxHealth = maxHealth;
            m_armor = armor;
            m_atkPow = atkPow;
            m_armorPen = armorPen;
            m_moveSpeed = moveSpeed;
            texture = tex;
            m_value = value;
            m_name = nam;

            m_sprite = new AnimatedSprite(tex, 0, 0, DISPLAY_SIZE, DISPLAY_SIZE, 1);
            m_sprite.tint = Color.White;
        }

        public void SetTex(Texture2D tex)
        {
            texture = tex;
            m_sprite = new AnimatedSprite(tex, 0, 0, DISPLAY_SIZE, DISPLAY_SIZE, 1);
            m_sprite.tint = Color.White;
        }

        public void Display(SpriteBatch sb, Rectangle destRect)
        {
            m_sprite.Draw(sb, destRect, Color.White);
        }

        public void Display(SpriteBatch sb, Vector2 location)
        {
            m_sprite.Draw(sb, (int)location.X, (int)location.Y);
        }

        public void Display(SpriteBatch sb, Vector2 location, float scale)
        {
            m_sprite.Draw(sb, location, scale);
        }
    }

    public class Weapon : Equipment 
    {
        public enum types { none = -1, pistol, shotgun, assault, plasma, sniper, siege };

        public Weapon
            (
            bool moveWhileAttacking,
            int maxHealth,
            int armor,
            int atkPow,
            float rat,
            int ran,
            int armorPen,
            float moveSpeed, 
            int value,
            string nam,
            Texture2D twoDTexture,
            Color newColor
            ) : base
            
            ( 
            moveWhileAttacking,
            maxHealth,
            armor,
            atkPow,
            armorPen,
            moveSpeed, 
            value,
            nam,
            twoDTexture)
        {
            color = newColor;
            range = ran;
            rate = rat;
        }

    }

    public class Armor : Equipment
    {
        public enum types { none = -1, clothes,basic,medium,heavy,enhanced };
        

        public Armor(
            bool moveWhileAttacking,
            int maxHealth,
            int armor,
            int atkPow,
            int armorPen,
            float moveSpeed,
            int value,
            string nam,
            Texture2D twoDTexture
            )
            : base

                (
                moveWhileAttacking,
                maxHealth,
                armor,
                atkPow,
                armorPen,
                moveSpeed,
                value,
                nam,
                twoDTexture)
        { }
    }

    public class Item : Equipment
    {
        public enum types { none = -1, nan, gloves, stim, organ, apround};

        public Item
             (
            bool moveWhileAttacking,
            int maxHealth,
            int armor,
            int atkPow,
            int armorPen,
            float moveSpeed,
            int value,
            string nam,
            Texture2D twoDTexture
            )
            : base

                (
                moveWhileAttacking,
                maxHealth,
                armor,
                atkPow,
                armorPen,
                moveSpeed,
                value,
                nam,
                twoDTexture)
        { }
    }

   
}
